<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="org.huqiwen.blog.data.BlogDataBean"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>我的博客</title>
<link type="text/css" href="skin/default/css/index.css" rel="stylesheet" />
<jsp:useBean id="blog" class="org.huqiwen.blog.logic.BlogLogicBean"/>
<jsp:useBean id="subStr" class="org.huqiwen.blog.logic.SubStringTest"/>
<%
	String str_curPage = request.getParameter("curPage");
	if(str_curPage!=null){
		blog.setCurPage(Integer.parseInt(str_curPage));
	}
	int allPage = blog.getAllPage();	
	int allRows = blog.getAllRows();
	int curPage = blog.getCurPage();
	int pageSize = blog.getPageSize();
	List blogList = blog.findAllBlog();	
	
	String username = (String)session.getAttribute("username");
%>
</head>	
<body>
	<div id="container">
		<jsp:include page="head.jsp"/>
		<jsp:include page="left.jsp"/>
		<div id="main">
			<%
			for(int i=0;i<blogList.size();i++){
				BlogDataBean blogBean = (BlogDataBean)blogList.get(i);
			 %>
			 <!-- 文章标题 -->
			 <div class="tit"><a href="BlogActionServlet?method=detailBlog&id=<%=blogBean.getBlogId()%>"><%=blogBean.getBlogTitle()%></a></div>
			 <!-- 发表日期 -->
			 <div class="date" id="date"><%=blogBean.getPostData()%></div>
			 <!-- 文章正文 -->
			<div class="content"><%=subStr.GetContentSummary(blogBean.getBlogContent(),500,true) %></div>
			<!-- 文章类别 -->
			<div class="blogcat">
			<div><a href="BlogActionServlet?method=detailBlog&id=<%=blogBean.getBlogId()%>">阅读全文>></a></div>
				<ul>
				<li>分类：<a href="FindByCatServlet?cat=<%=blogBean.getBlogCategory()%>"><%=blogBean.getBlogCategory()%></a> |</li>
				<%if(username!=null){%>
				<li><a href="BlogActionServlet?method=editorBlog&id=<%=blogBean.getBlogId()%>">编辑</a> |</li>
				<li><a href="BlogActionServlet?method=delBlog&id=<%=blogBean.getBlogId()%>">删除</a> |</li>
				<%}%>
				<li><a href="BlogActionServlet?method=detailBlog&id=<%=blogBean.getBlogId()%>">浏览(<%=blogBean.getBlogCount()%>)</a></li>
				</ul><br />
			</div>
			<hr />
			<%}%>
			<!-- 分页 -->
			<span　class="paging">
			<%if(curPage!=1){%>
				<a href="index.jsp?curPage=1">首页</a>
				<a href="index.jsp?curPage=<%=curPage-1%>">上一页</a>
			<%}if(curPage!=blog.getAllPage()){%>
				<a href="index.jsp?curPage=<%=curPage+1%>">下一页</a>
				<a href="index.jsp?curPage=<%=blog.getAllPage()%>">末页</a>
			<%} %>
			</span>
		</div>
		<%@include file="foot.jsp" %>
	</div>
</body>
</html>

